package com.venus.kafka.consumer.service;

import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

import com.google.gson.Gson;
import com.venus.kafka.bean.MessageInfo;

import lombok.extern.slf4j.Slf4j;

/**
 * @author lwl
 * @date 2020/9/1 17:56
 */
@Service
@Slf4j
public class ConsumerService {

	@KafkaListener(topics = "venus")
	public void consume(String str) {
		Gson gson = new Gson();
		MessageInfo messageInfo = gson.fromJson(str, MessageInfo.class);
		log.info("comsumer ############# ");
		log.info("comsumer :" + messageInfo.getId());
		log.info("comsumer ############# ");

	}

}
